#ifndef _pref_h
#define _pref_h

#include "../DAL/dal.h"
#include "wx/grid.h"

extern wxMBConv* charset;

#define ENTER wxT("\n")
#define SPACE wxT(" ")
#define TAB	wxT("\t")
#define GBK wxT("GBK")
#define CONF wxT("./iMySQL-Front.ini")
#define MYSQL_GONE_AWAY wxT("MySQL has gone away\nPlease reconnect the server")
#define MYSQL_PRIV_WARNING wxT("Error occurs\nMaybe you don't have this privileges")
#define MYSQL_ERROR wxT("Error occurs\nError no is %d")
#define MSG_ERR wxT("Error")

#define VERSION wxT("iMySQL-Front 0.1.6 ")
#define ABOUT wxT("iMySQL-Front\n\nWritten by:\tDavid Jiang\nVersion:\t\t") VERSION wxT("\nhomepage:\thttp://code.google.com/p/imysql-front/")

//#define ERROR wxT("Application encounter an error\nError number is:%")

/*WX_DECLARE_OBJARRAY(int,NullArray);
#include "wx/arrimpl.cpp"
WX_DEFINE_OBJARRAY(NullArray);*/ 

WX_DEFINE_ARRAY_INT(int, NullArray);


enum {
	ID_LOAD_RESULT
};

enum RunSQLType{
	All,
	CurrentLine,
	Selected
};

enum TreeNodeType{
	server=0,
	db=1,
	table=2,
	sp_folder=3,
	sp=4,
	sp_parm=5,
	func_folder=6,
	func=7,
	func_parm=8,
	view_folder=9,
	view=10
};

enum RoutineType{
	r_sp = 0,
	r_func = 1
};

class QResult{
public:
	int col;
	int row;
	ResultType type;
	wxString msg ; 
	wxArrayString result;
	NullArray nullArray;
	QResult(){ col = 0; row = 0 ; type = sets; msg = wxEmptyString;}
};

class ConfInfo{
public:
    wxString name;
    wxString ip;
    wxString user;
    wxString pwd;
    wxString port;
    wxString db;
public:
    ConfInfo(wxString name,wxString ip,wxString user,wxString pwd,wxString port,wxString db)
            :name(name),ip(ip),user(user),pwd(pwd),port(port),db(db) {}
};

WX_DECLARE_OBJARRAY(ConfInfo,ConfArray);
WX_DECLARE_OBJARRAY(QResult,ResultArray);
WX_DECLARE_OBJARRAY(wxGrid*,wxGridArray);


#endif